package calbs.socket.jms.consumer.trace;

import calbs.socket.dao.ServerDao;
import calbs.socket.pojo.req.ReqUploadLocationMsg;
import calbs.socket.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 轨迹消息队列监听器
 */
@Component("consumerListener")
public class TraceListener {
	private static final Logger logger = LoggerFactory.getLogger(TraceListener.class);
	private ServerDao serverDao = SpringUtil.getBean(ServerDao.class);
	public void handleMessage(String message) {
		logger.info("gps info ----> {}",message);
		serverDao.insertLocation(JSON.parseObject(message, ReqUploadLocationMsg.class));

	}
}